package tech.soulcoder.core.audit;

import com.alibaba.fastjson.JSON;

import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author yunfeng.lu
 * @date 2018/9/24
 */
public class AuditServiceImpl implements IAuditService {
    private AuditService auditService;

    @Autowired
    public AuditServiceImpl(AuditService auditService) {
        this.auditService = auditService;
    }

    @Override
    public void audit(int operatorId, String operator, String action, Object[] params, String mainType,
                      String subType) {
        this.auditService.audit(operatorId, operator, action, params != null ? JSON.toJSONString(params) : null,
                mainType, subType);
    }
}
